package com.yupi.springbootinit.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yupi.springbootinit.model.entity.Chart;
import com.yupi.springbootinit.service.ChartService;
import com.yupi.springbootinit.mapper.ChartMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author tester
* @description 针对表【chart(图表信息表)】的数据库操作Service实现
* @createDate 2024-05-09 18:06:46
*/
@Service
public class ChartServiceImpl extends ServiceImpl<ChartMapper, Chart>
    implements ChartService{

    @Resource
    private ChartMapper chartMapper;


    @Override
    public String generateCreateTableSql(String tableName, List<String> columns) {
        StringBuilder sql = new StringBuilder("CREATE TABLE ").append(tableName).append(" (");

        for (String column : columns) {
            sql.append(column).append(" text, ");
        }
        sql.setLength(sql.length() - 2);
        sql.append(")");
        return sql.toString();
    }
}




